package canglang.scan.erecord.service.impl;

import java.util.List;

import canglang.scan.core.base.pagination.PaginatedListHelper;
import canglang.scan.erecord.dao.ErecordDAO;
import canglang.scan.erecord.model.ErecordModel;
import canglang.scan.erecord.service.ErecordManager;
import canglang.scan.erecord.to.SearchTO;

@SuppressWarnings("unchecked")
public class ErecordManagerImpl implements ErecordManager {
    
    private ErecordDAO erecordDAO;
    
    
    /**
     * @param erecordDAO the erecordDAO to set
     */
    public void setErecordDAO (ErecordDAO erecordDAO) {
        this.erecordDAO = erecordDAO;
    }

    public PaginatedListHelper searchErecord (PaginatedListHelper helper, SearchTO searchTO) {
        int count = erecordDAO.searchCount(searchTO);
        helper.setFullListSize(count);
        List list = erecordDAO.searchList(helper, searchTO);
        helper.setList(list);
        return helper;
    }

    public ErecordModel addErecord (ErecordModel erecordModel) {
       return  erecordDAO.addErecord(erecordModel);

    }

    public ErecordModel getErecord (int recordId) {
        return erecordDAO.getErecord(recordId);
    }

    public ErecordModel saveErecord (ErecordModel erecordModel) {
        return erecordDAO.saveErecord(erecordModel);
    }

    public void deleteErecord (int recordId) {
        erecordDAO.deleteErecord(recordId);
    }
}
